import React ,{useEffect} from 'react'

import {
  useDispatch, 
  useSelector 
} from "react-redux"
import * as api from "./api/index" 

function App() {
  const dispatch = useDispatch()
  
  useEffect(()=>{
    dispatch(api.get_list())
  },[dispatch])

  const list = useSelector((state)=>{
    return state.reduce.list
  })

  console.log(list,"22222");
  return (
    <div>
      App
      {
        list && list.length >0 ? list.map((item,index)=>{
          return <div key={index}>{item.name}</div>
        }):"暂无数据"
      }
    </div>
  )
}

export default App